package com.example.home_app.http.AATest

import com.example.home_app.base.Onenet_online.Online_json
import com.example.home_app.http.base.HistoricalData.HistoricalJsonRootBean
import io.reactivex.Observable
import okhttp3.ResponseBody
import retrofit2.Call
import retrofit2.http.*

/**
 * Created by xuzhb on 2019/8/8
 * Desc:免费的公共接口 https://blog.csdn.net/rosener/article/details/81699698
 */
interface ApiService {

    //简单的访问IP地址，Retrofit
    @GET("/")
    fun accessUrl(): Call<ResponseBody>

    //简单的访问IP地址，Retrofit + RxJava
    @GET("/")
    fun accessUrlRxJava(): Observable<ResponseBody>
    @FormUrlEncoded
    @POST("devices/735471469/datapoints?")
    fun getDeviceMessage(@Header("api-key") key: String?,@Field("type") type: String,
                         @Header("Content-Length") Content: String,@Field("value") value: String)
    : Observable<ResponseBody?>?
    @GET("devices/status")
    fun getMessage(@Header("api-key") key: String?, @Query("devIds") ids: String?)
    : Observable<Online_json?>?

    @GET
    fun getHistory(@Url url: String?, @Header("api-key") key: String?, @Query("end") end: String?, @Query("start") start: String?, @Query("sort") sort: String?)
    : Observable<HistoricalJsonRootBean?>?

    @GET
    fun getHistor(@Url url: String?, @Header("api-key") key: String?, @Query("end") end: String?, @Query("start") start: String?, @Query("sort") sort: String?)
    : Observable<Online_json?>?
}